
1. | How to implement Push-To-Talk? |
Push-To-Talk should be implemented by toggling the client variable
For Push-To-Talk toggle between Example code: unsigned int error;
bool shouldTalk;
shouldTalk = isPushToTalkButtonPressed(); // Your key detection implementation
if((error = ts3client_setClientSelfVariableAsInt(scHandlerID, CLIENT_INPUT_DEACTIVATED,
shouldTalk ? INPUT_ACTIVE : INPUT_DEACTIVATED))
!= ERROR_ok) {
char* errorMsg;
if(ts3client_getErrorMessage(error, &errorMsg) != ERROR_ok) {
printf("Error toggling push-to-talk: %s\n", errorMsg);
ts3client_freeMemory(errorMsg);
}
return;
}
if(ts3client_flushClientSelfUpdates(scHandlerID) != ERROR_ok) {
char* errorMsg;
if(ts3client_getErrorMessage(error, &errorMsg) != ERROR_ok) {
printf("Error flushing after toggling push-to-talk: %s\n", errorMsg);
ts3client_freeMemory(errorMsg);
}
}It is not necessary to close and reopen the capture device to implement Push-To-Talk. Basically it would be possible to toggle If you need to query the current muted state, use
int hardwareStatus, deactivated, muted;
if(ts3client_getClientSelfVariableAsInt(scHandlerID, CLIENT_INPUT_HARDWARE,
&hardwareStatus) != ERROR_ok) {
/* Handle error */
}
if(ts3client_getClientSelfVariableAsInt(scHandlerID, CLIENT_INPUT_DEACTIVATED,
&deactivated) != ERROR_ok) {
/* Handle error */
}
if(ts3client_getClientSelfVariableAsInt(scHandlerID, CLIENT_INPUT_MUTED,
&muted) != ERROR_ok) {
/* Handle error */
}
if(hardwareStatus == HARDWAREINPUT_DISABLED) {
/* No capture device available */
}
if(deactivated == INPUT_DEACTIVATED) {
/* Input was deactivated for Push-To-Talk (not propagated to server) */
}
if(muted == MUTEINPUT_MUTED) {
/* Input was muted (propagated to server) */
}When using Push-To-Talk, you should deactivate Voice Activity Detection in the preprocessor or keep the VAD level very low. To deactivate VAD, use: ts3client_setPreProcessorConfigValue(serverConnectionHandlerID, "vad", "false");
| |
2. | How to adjust the volume? |
Output volume Voice output volume can be adjusted by changing the “volume_modifier” playback option using the function Example to increate the output volume by 10 decibel: ts3client_setPlaybackConfigValue(scHandlerID, "volume_modifier", 10); Input volume Automatic Gain Control (AGC) takes care of the input volume during preprocessing automatically. Instead of modifying the input volume directory, you modify the AGC preprocessor settings with |